import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
import Meizi from "../views/Meizi"
import Admin from "../views/Admin"

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
  },
  {
    path: "/meizi/:id",
    name: "Meizi",
    component: Meizi,
  },
  // /m
  // /m/cart
  // /m/type
  {
    path: "/m",
    component: () => import('@/views/M'),
    children: [
      {
        path: "",
        name: "MHome",
        component: () => import("../views/M/Home")
      },
    ]
  },
  // /admin/article
  // /admin/about
  {
    path: "/admin",
    component: Admin,
    children: [
      {
        path: "",
        name: "Admin",
        component: () => import("../views/Admin/Profile")
      },
      {
        path: "article",
        name: "Article",
        component: () => import("../views/Article")
      },
      {
        path: "about",
        name: "About",
        component: () => import("../views/About.vue"),
      },
    ]
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
